import { message } from 'ant-design-vue';

import { checkNameForm, checkCount } from "./formRuler";
import { dataSourceType } from '@type';
const selectOptions: dataSourceType[] = [
  { label: '不限制', value: '' },
  { label: '只能输入中文', value: 'chinese' },
  { label: '只能输入英文', value: 'english' },
  { label: '只能输入数字', value: 'float' },
  { label: '只能输入英文和数字', value: 'haveCnEnNum' },
  { label: '只能输入整数', value: 'number' },
  { label: '只能输入中文、英文和数字', value: 'cnEnNum' },
  { label: '只能输入邮箱', value: 'email' },
  { label: '只能输入手机号', value: 'mobile' },
  { label: '只能输入座机号', value: 'phone' },
  { label: '只能输入手机或座机号', value: 'phoneAll' },
  { label: '只能输入身份证号', value: 'identity' },
  { label: '只能输入邮政编码', value: 'postal' },
]
// isBoolean:true, // 是否为Boolean类型, 参数是否必须为boolen类型，不是根据options个数判断，是根据后台字段类型要求判断
const itemForm = [
  {
    value: '',
    type: 'inputSettings',
    id: '',
    children: [
      {
        value: '单行输入',
        placeholder: '请输入',
        param: 'label',
        rule: {
          required: false,
          validator: checkNameForm,
          trigger: ["blur"],
          msg1: '1111',
          msg2: '组件标题不能重复!',
          api: "fetchOssNameUnique",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "组件标题:",
        beforeText: '',
        afterText: '',
        width: '',
        showCount: false,
        disable: true,
        marginLeft: 0,
        marginTop: 0,
        type: 'textInput',
        associated: '',
        associatedValue: '',
      },
      {
        value: 'input',
        placeholder: '请输入',
        param: 'param',
        rule: {
          required: true,
          //validator: checkNameForm,
          trigger: ["blur"],
          message: '组件标签必填!',
          api: "fetchOssNameUnique",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "组件标签:",
        beforeText: '',
        afterText: '',
        width: '',
        showCount: false,
        disable: true,
        marginLeft: 0,
        marginTop: 0,
        type: 'textInput',
        associated: '',
        associatedValue: '',
      },
      {
        value: '',
        placeholder: '请输入',
        param: 'placeholder',
        rule: {
          required: false,
          //validator: checkNameForm,
          trigger: ["blur"],
          msg1: '1111',
          msg2: '组件提示不能重复!',
          api: "fetchOssNameUnique",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "组件提示:",
        beforeText: '',
        afterText: '',
        width: '',
        showCount: false,
        disable: true,
        marginLeft: 0,
        marginTop: 0,
        type: 'textInput',
        associated: '',
        associatedValue: '',
      },
      {
        value: '',
        placeholder: '请输入',
        param: 'helpMsg',
        rule: {
          required: false,
          //validator: checkNameForm,
          trigger: ["blur"],
          msg1: '1111',
          msg2: '帮助信息不能重复!',
          api: "fetchOssNameUnique",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "帮助信息:",
        beforeText: '',
        afterText: '',
        width: '',
        showCount: false,
        disable: true,
        marginLeft: 0,
        marginTop: 0,
        type: 'textInput',
        associated: '',
        associatedValue: '',
      },
      {
        value: '',
        placeholder: '请选择',
        param: 'validator',
        rule: {
          required: false,
          //validator: checkNameForm,
          trigger: [""],
          message: '储存类型不能为空',
          api: "",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "可输入内容限制:",
        beforeText: '',
        afterText: '',
        width: '',
        marginLeft: 0,
        type: 'multipleSelect',
        options: selectOptions,
        mode: 'single',
        associated: '',
        associatedValue: '',
      },
      {
        value: false,
        param: 'rule',
        rule: {
          required: false,
          //validator: checkCreatSiteForm,
          trigger: ["blur"],
          msg1: '',
          msg2: '',
          api: "",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "是否必填:",
        marginLeft: 0,
        type: 'radio',
        isBoolean: true, // 是否为Boolean类型
        options: ['是', '否'],
        tips: '',
      },
      {
        value: [],
        param: 'scene',
        rule: {
          required: false,
          //validator: checkCreatSiteForm,
          trigger: ["blur"],
          msg1: '',
          msg2: '',
          api: "",
          key: 'siteDomain',
          params: {}, //校验传参
        },
        label: "应用场景:",
        marginLeft: 0,
        type: 'checkbox',
        isBoolean: false, // 是否为Boolean类型
        options: ['会员注册', '会员个人资料页面'],
        tips: '',
      },
    ]
  },
]
export { itemForm }